//
//  ClassSearchHomeVIew.m
//  Experss
//
//  Created by wmwMAC on 17/7/27.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "ClassSearchHomeVIew.h"

@implementation ClassSearchHomeVIew

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addOtherUI];
    }
    return self;
}


-(void)addOtherUI {
//    _locationBtn = [BasePublicCreatUI createButtonFrame:CGRectMake(5, 2, (180*kUIScreenWidth)/1242, 40) backImageName:nil title:@"杭州" titleColor:[UIColor whiteColor] font:kfont(14) target:self action:@selector(locationbuttonclick:)];
//    [_locationBtn setImage:KGetImage(@"homeLocation") forState:UIControlStateNormal];
//    _locationBtn.tintColor = [UIColor whiteColor];
//    _locationBtn.tag = 100;
//    [self addSubview:_locationBtn];
    
    
    UITextField *searchtext = [BasePublicCreatUI createTextFielfFrame:CGRectMake(20, 7, kScreen_Width-80, 30) font:kFont14 placeholder:nil];
    searchtext.layer.cornerRadius = 15;
    searchtext.layer.masksToBounds = YES;
    UIImageView *smallImageView = [BasePublicCreatUI createImageViewFrame:CGRectMake(10, 7, 15, 15)  imageName:@"fenlei_sousuo" color:[UIColor clearColor]];
    searchtext.userInteractionEnabled = NO;
//    smallImageView.backgroundColor = [UIColor grayColor];
    searchtext.enabled = NO;
    UIView *leftview= [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
    [leftview addSubview:smallImageView];
    searchtext.leftView = leftview;
    searchtext.backgroundColor = kRGB(241, 245,252);
    searchtext.text = @"请出入您想搜索的内容";
    searchtext.textColor = [UIColor lightGrayColor];
    [self addSubview:searchtext];
    _searchBtn = [BasePublicCreatUI createBtnFrame:searchtext.frame  title:nil bgImage:nil selectBgImage:nil image:nil target:self action:@selector(locationbuttonclick:)];
    _searchBtn.tag = 101;
    [self addSubview:_searchBtn];
    _rightBtn = [BasePublicCreatUI createBtnFrame:CGRectMake(CGRectGetMaxX(searchtext.frame)+10, 7, (150*kScreen_Width)/1242, 30) title:nil bgImage:nil selectBgImage:nil image:nil target:self action:@selector(locationbuttonclick:)];
    [_rightBtn setImage:KGetImage(@"fenlei_xiaoxi") forState:UIControlStateNormal];
    _rightBtn.tag = 102;
    [self addSubview:_rightBtn];
    
}


-(void)locationbuttonclick:(UIButton *)sender {
//    if (sender.tag == 100) {
//        [self.delegate leftButtonclcik];
//    }else
    
    if (sender.tag ==101){
        [self.delegate middlebuttonclcik];
    }else {
        [self.delegate rightButtonclcik];
    }
}


@end
